<template>
  <el-card class="web-tool-editor">
    <div
      slot="header"
      class="clearfix">
      <span>PDF查看器</span>
    </div>
    <div class="content-btns">
      <el-button
        size="mini"
        type="primary"
        @click="btnClick(0)">自定义组件</el-button>
      <el-button
        size="mini"
        type="primary"
        @click="btnClick(1)">PDF.js</el-button>
    </div>
  </el-card>
</template>

<script>
  export default {
    name: "WebToolPdf",
    methods: {
      btnClick(type) {
        this.$w_popview.prompt('请输入PDF文件线上地址').then((value) => {
          const query = `?file=${value}`
          if (value) {
            window.open(`${ type ? process.env.VUE_APP_PDF_JS : process.env.VUE_APP_PDF_VUE}${query}`)
          } else {
            this.$w_popview.msgError('请输入文件地址')
          }
        }).catch(() => {})
      }
    }
  }
</script>

<style scoped>

</style>
